#ifndef BOARD_H_INCLUDED
#define BOARD_H_INCLUDED


// Note: We could duplicate the iArr typedef here and again, avoid the
// inclusion of the GameResources header file. This is allowed since
// the 1998 C++ standard.


#include <array>


#include "GRoutines.h"
#include "Position.h"
#include "Mark.h"


#define R 3


typedef std::array <SDL_Surface*, 8> iArr;


void initGameBoard(Mark (&game_board)[R][R]);
bool isFull(const Mark (&game_board)[R][R]);
bool checkVictory(const Mark (&game_board)[R][R], Mark);
bool checkTie(const Mark (&game_board)[R][R]);
void Restart(iArr&, Mark (&game_board)[R][R]);


inline bool isEmpty(const Mark game_board[R][R], Position p)
{
    return game_board[p.row][p.col] == Mark::EMPTY;
}


inline void updateGameBoard(Mark (&game_board)[R][R], const Position& p, Mark mark)
{
    game_board[p.row][p.col] = mark;
}


#undef R


#endif // BOARD_H_INCLUDED
